package o;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.text.TextUtils;
import com.huawei.appgallery.foundation.service.common.protocol.AppDetailActivityProtocol;
import com.huawei.appgallery.foundation.service.common.protocol.AppDetailActivityProtocol.Request;
import com.huawei.appgallery.foundation.ui.framework.cardframe.bean.BaseCardBean;
import com.huawei.hms.support.api.entity.hwid.HwIDConstant.ACTION;
import com.huawei.hwid.core.constants.HwAccountConstants;
import o.cii.c;

public class dpj implements c {
    private static void ˊ(Context context, String str, String str2, String str3) {
        cjo appDetailActivityProtocol = new AppDetailActivityProtocol();
        if (TextUtils.isEmpty(str2)) {
            str2 = drj.ॱ(str);
        }
        appDetailActivityProtocol.ˏ(new Request(str2, str3));
        cjk.ˎ().ˋ(context, new cjm("appdetail.activity", appDetailActivityProtocol));
    }

    public void ˏ(Context context, BaseCardBean baseCardBean) {
        if (context != null && baseCardBean != null) {
            String ॱॱ = baseCardBean.ॱॱ();
            String u_ = baseCardBean.u_();
            String ॱـ = baseCardBean.ॱـ();
            if (TextUtils.isEmpty(ॱـ)) {
                ˊ(context, ॱـ, ॱॱ, u_);
            } else if (erz.ˏ(context, ॱـ)) {
                ˊ(context, baseCardBean);
            } else {
                ˊ(context, ॱـ, ॱॱ, u_);
            }
        }
    }

    private void ˊ(Context context, BaseCardBean baseCardBean) {
        int i;
        String ॱॱ = baseCardBean.ॱॱ();
        String ˊʼ = baseCardBean.ˊʼ();
        String u_ = baseCardBean.u_();
        String ॱـ = baseCardBean.ॱـ();
        int ˎ = dgm.ˎ((Activity) context);
        try {
            Intent intent = new Intent();
            intent.setAction(ACTION.HWID_SCHEME_URL);
            intent.setData(Uri.parse(ˊʼ));
            intent.setFlags(268435456);
            intent.setPackage(ॱـ);
            context.startActivity(intent);
            i = 0;
            cgo.ˋ(HwAccountConstants.TYPE_SECURITY_PHONE, ॱॱ, ˎ);
        } catch (Exception e) {
            Logger.ˏ("PromotionDeepLinkEventListener", e.toString());
            i = -1;
            ˊ(context, ॱـ, ॱॱ, u_);
        }
        dgh.ˋ("340301", evg.ॱ(ˊʼ, ॱॱ, ॱـ, ˎ, i));
    }
}
